﻿#include "Pai.h"


qint32 _JiNeng::arrayTuoFuTime[] = {9000,7000,5000,3000,1000};

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////




_Pai::_Pai(QObject *parent): _BaseObject(parent)
{
    m_eObjType = ObjType_Pai;
    m_ePaiType = Type_Null;
    m_ePaiValue = Value_Null;
    setPosition(Area_Null,-1,-1);
}

_Pai::~_Pai()
{
    clearAllJiNeng();
}

void _Pai::setPosition(_Area area ,qint32 value ,qint32 player)
{
    bool flag = false;
    if(m_eArea != area) {
        m_eArea = area;
        flag = true;
    }
    if(m_nPositionValue != value) {
        m_nPositionValue = value;
        flag = true;
    }
    if(m_nPositionPlayer != player) {
        m_nPositionPlayer = player;
        flag = true;
    }
    if(flag)
    {
        emit positionChanged();
        //qDebug()<<"id:"<<m_nID<<"positionChanged!!!";
    }
}

QString _Pai::getName(_PaiValue v)
{
    QString name = _T("<font size=3 color=#FFFF60>%1</font>");
    switch(v)
    {
    case Value_Sha:
        return name.arg("考试");
    case Value_Shan:
        return name.arg("解答");
    case Value_Tao:
        return name.arg("答案");
    case Value_Chai:
        return name.arg("拆书");
    case Value_Shun:
        return name.arg("借笔记");
    case Value_WuZhong:
        return name.arg("发新书");
    case Value_JieDao:
        return name.arg("借笔考试");
    case Value_WanJian:
        return name.arg("英语六级");
    case Value_NanMan:
        return name.arg("英语四级");
    case Value_GaoKao:
        return name.arg("高考");
    case Value_ShanDian:
        return name.arg("托福");
    case Value_LeBuSiShu:
        return name.arg("错过考试");
    case Value_LianNu:
        return name.arg("自动笔");     //name.arg("连弩");
    case Value_ZhangBa:
        return name.arg("毛笔");      //丈八
    case Value_QingLong:
        return name.arg("钢笔");      //青龙
    case Value_GuanShiFu:
        return name.arg("圆珠笔");     //贯石斧
    case Value_HanBing:
        return name.arg("铅笔");      //寒冰剑
    case Value_TanSu:
        return name.arg("碳素笔");

    case Value_JiNeng_ZuoYongLi:
        return name.arg("作用力");
    case Value_JiNeng_DaHangHaiShiDai:
        return name.arg("大航海时代");
    case Value_JiNeng_DuXiu:
        return name.arg("独秀");
    case Value_JiNeng_ShenQu:
        return name.arg("神曲");
    case Value_JiNeng_MengGuDiGuo:
        return name.arg("蒙古帝国");
    case Value_JiNeng_ZhanZhengZhiShen:
        return name.arg("战争之神");
    case Value_JiNeng_MengNaLiSha:
        return name.arg("蒙娜丽莎");
    case Value_JiNeng_KaiSa:
        return name.arg("凯撒");
    case Value_JiNeng_AYuWang:
        return name.arg("阿育王");
    case Value_JiNeng_JunShiTanDing:
        return name.arg("君士坦丁");

    default:
        return name.arg("错牌");
    }
}























_WuJiang::_WuJiang(QObject *parent): _BaseObject(parent)
{
    _BaseObject::setProp(-1,ObjType_WuJiang,Area_WuJiang);
    setMaxBloodCount(-1);
    //eValue = Value_Null;
}

_WuJiang::~_WuJiang()
{
    clearAllJiNeng();
}

QString _WuJiang::getName(_Value v)
{
    QString name = _T("<font size=3 color=#FF5555>%1</font>");
    switch (v)
    {
    case Value_LiLei:
        return name.arg("李雷");
    case Value_HanMeiMei:
        return name.arg("韩梅梅");
    case Value_NiuDun:
        return name.arg("牛顿");
    case Value_GeLunBu:
        return name.arg("哥伦布");
    case Value_YaLiShanDa:
        return name.arg("亚历山大");
    case Value_DanDing:
        return name.arg("旦丁");
    case Value_ChengJiSiHan:
        return name.arg("成吉思汗");
    case Value_NaPoLun:
        return name.arg("拿破仑");
    case Value_DaFenQi:
        return name.arg("达芬奇");
    case Value_KaiSa:
        return name.arg("凯撒");
    case Value_AYuWang:
        return name.arg("阿育王");
    case Value_ChengDuXiu:
        return name.arg("陈独秀");
    default:
        return name.arg("谁?");
    }
}

_WuJiang::_Value _WuJiang::setProp(_WuJiang::_Value v)
{
    //_WuJiang* wj = new _WuJiang;
    m_nID = v;
    clearAllJiNeng();

    switch(v)
    {
    case Value_LiLei:
        setMaxBloodCount(7);
        break;
    case Value_HanMeiMei:
        setMaxBloodCount(5);
        break;
    case Value_NiuDun:
        setMaxBloodCount(4);
        m_listJiNengPai.append(_Pai::createJiNengPai(_Pai::Value_JiNeng_ZuoYongLi));
        break;
    case Value_GeLunBu:
        setMaxBloodCount(4);
        m_listJiNengPai.append(_Pai::createJiNengPai(_Pai::Value_JiNeng_DaHangHaiShiDai));
        break;
    case Value_ChengDuXiu:
        setMaxBloodCount(3);
        m_listJiNengPai.append(_Pai::createJiNengPai(_Pai::Value_JiNeng_DuXiu));
        break;
    case Value_DanDing:
        setMaxBloodCount(4);
        m_listJiNengPai.append(_Pai::createJiNengPai(_Pai::Value_JiNeng_ShenQu));
        break;
    case Value_ChengJiSiHan:
        setMaxBloodCount(4);
        m_listJiNengPai.append(_Pai::createJiNengPai(_Pai::Value_JiNeng_MengGuDiGuo));
        break;
    case Value_NaPoLun:
        setMaxBloodCount(4);
        m_listJiNengPai.append(_Pai::createJiNengPai(_Pai::Value_JiNeng_ZhanZhengZhiShen));
        break;
    case Value_DaFenQi:
        setMaxBloodCount(4);
        m_listJiNengPai.append(_Pai::createJiNengPai(_Pai::Value_JiNeng_MengNaLiSha));
        break;
    case Value_KaiSa:
        setMaxBloodCount(4);
        m_listJiNengPai.append(_Pai::createJiNengPai(_Pai::Value_JiNeng_KaiSa));
        break;
    case Value_AYuWang:
        setMaxBloodCount(4);
        m_listJiNengPai.append(_Pai::createJiNengPai(_Pai::Value_JiNeng_AYuWang));
        break;
    case Value_YaLiShanDa:
        setMaxBloodCount(4);
        m_listJiNengPai.append(_Pai::createJiNengPai(_Pai::Value_JiNeng_JunShiTanDing));
        break;
    default:
        setMaxBloodCount(4);
    }

    return v;
}










/*
    connect(this,&Graphics_Pai::s_mouseClick,this,&Graphics_Pai::m_Click);
    connect(this,&Graphics_Pai::s_RefreshPai,this,&Graphics_Pai::m_RefreshPai);

void Graphics_Pai::m_Click(Qt::MouseButton mouseButton)
{
    if(!(this->eFlags & _BaseObject::Flag_Enable))
    {
        //qDebug()<<this->iType<<","<<this->m_nPositionPlayer<<",ID(hide):"<<this->m_nID << "zvalue" << zValue();
        return;
    }

    if(mouseButton == Qt::LeftButton && (this->eFlags & _BaseObject::Flag_Enable))
    {
        DianJiPai m_DianJiPaiai;
        m_DianJiPaiai.nPlayerID = m_nPositionPlayer;
        m_DianJiPaiai.nType = m_eArea;
        if(m_DianJiPaiai.nType == _BaseObject::Area_WuJiang)
            m_DianJiPaiai.nValue = m_nPositionPlayer;
        else
            m_DianJiPaiai.nValue = iPositionAreaValue;
        m_DianJiPaiai.eFlags = eFlags;
        m_DianJiPaiai.pObject = this;

        qDebug()<<this->iType<<","<<this->m_nPositionPlayer<<",ID:"<<this->m_nID << "zvalue:" << zValue();
        //if(event->button() == Qt::LeftButton)
        //    QMessageBox::information(nullptr,"aa","aa");
        emit s_ClickPai(m_DianJiPaiai);
    }
}


emit s_RefreshPai();
emit s_SetPaiPosition(area,areaValue,player,this);
signals:
void s_ClickPai(DianJiPai);
void s_RefreshPai();
void s_SetPaiPosition(int area,int areaValue,int player,Graphics_Pai* pPai);
*/
